<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<div class="container" id="container1">
  <img id="img1" src="missing-image.png" alt="Missing">
</div>

<script>
test(function(t) {
    var axImg1 = accessibilityController.accessibleElementById("img1");
    assert_equals(axImg1.name, "Missing");
    assert_equals(axImg1.childrenCount, 0);
}, "An image exposes alt text as its name, and has no children.");
</script>

<div class="container" id="container2">
  <img id="img2" src="missing-image.png" alt="Missing" role="presentation">
</div>

<script>
test(function(t) {
    var axImg2 = accessibilityController.accessibleElementById("img2");
    assert_equals(axImg2, undefined);
    var axContainer2 = accessibilityController.accessibleElementById("container2");
    assert_equals(axContainer2.role, "AXRole: AXGenericContainer");
    assert_equals(axContainer2.childrenCount, 0);
}, "A presentational image is missing from the accessibility tree entirely.");
</script>
